| NodeFindEx2 Method |
Search for a specific Node object &/or a Group of Node objects containing specific text in the TreeView control.
Syntax
object.NodeFindEx2(LikeText, StartNode, FindMode, CompareMethod)
The NodeFindEx2 Method syntax has these parts:
| Part | Description |
|---|---|
| object | Required. An object expression that evaluates to an object in the Applies To list. |
| LikeText | Required. Any (pattern-matching) string expression. |
| StartNode | Optional. A valid Node (MSComctlLib.Node) object.. |
| FindMode | Optional. Specifies what property of the Node object to search, as described in settings. |
| CompareMethod | Optional. Specifies whether to force case matching, as described in settings. |
Settings
The settings for FindMode operator are:
| Setting | Description |
|---|---|
| [Find Node Text] | (Default) Only searches a Node object's Text property. |
| [Find Node Key] | Only searches a Node object's Key property. |
| [Find Node Text And Key] | Search the Node object's Text & Key properties. |
The settings for CompareMethod operator are:
| Setting | Description |
|---|---|
| True | Performs a binary comparison. |
| False | (Default) Performs a textual comparison. |
Remarks
The behaviour of the pattern-matching LikeText depends on the CompareMethod chosen.
CompareMethod = vbBinaryCompare results in string comparisons based on a sort oder derived from the internal binary representations of the characters. Sort order is determined by the code page. In the following example, a typical binary sort order is shown:
A < B < E < Z < a < b < e < z < À < Ê < Ø < à < ê < ø
CompareMethod = vbTextCompare results in string comparisons based on a case-insensitive, textual sort order determined by your system's locale. When you sort The same characters using vbTextCompare, the following text sort order is produced:
(A=a) < (À=à) < (B=b) < (E=e) < (Ê=ê) < (Z=z) < (Ø=ø)
Built-in pattern matching provides a versatile tool for string comparisons. The pattern-matching features allow you to use wildcard characters, character lists, or character ranges, in any combination, to match strings. The following table shows the characters allowed in pattern and what they match:
| Characters in pattern | Matches in string |
| ? | Any single character. |
| * | Zero or more characters. |
| # | Any single digit (0–9). |
| [charlist] | Any single character in charlist. |
| [!charlist] | Any single character not in charlist. |
A group of one or more characters (charlist) enclosed in brackets ([ ]) can be used to match any single character in string and can include almost any character code, including digits.
Note To match the special characters left bracket ([), question mark (?), number sign (#), and asterisk (*), enclose them in brackets. The right bracket (]) can't be used within a group to match itself, but it can be used outside a group as an individual character.
By using a hyphen (–) to separate the
upper and lower bounds of the range, charlist can specify a range of
characters. For example, [A-Z] results in a match if the
corresponding character position in string contains any uppercase letters
in the range A–Z. Multiple ranges are included within the brackets without
delimiters.
Other important rules for pattern matching include the following:
[A-Z]
is a valid pattern, but [Z-A] is not.[] is
considered a zero-length string ("").In some languages, there are special characters in the alphabet that represent two separate characters. For example, several languages use the character "æ" to represent the characters "a" and "e" when they appear together. The LikeText recognizes that the single special character and the two individual characters are equivalent.
When a language that uses a special character is specified in the system locale settings, an occurrence of the single special character in either pattern or string matches the equivalent 2-character sequence in the other string. Similarly, a single special character in pattern enclosed in brackets (by itself, in a list, or in a range) matches the equivalent 2-character sequence in string.
The following table shows how you can use Like to test expressions for different patterns.
| Kind of match | Pattern | Match (returns True) | No match (returns False) |
| Multiple characters | a*a | aa, aBa, aBBBa | aBC |
| *ab* | abc, AABB, Xab | aZb, bac | |
| ab* | abcdefg, abc | cab, aab | |
| Special character | a[*]a | a*a | aaa |
| Single character | a?a | aaa, a3a, aBa | aBBBa |
| Single digit | a#a | a0a, a1a, a2a | aaa, a10a |
| Range of characters | [a-z] | f, p, j | 2, & |
| Outside a range | [!a-z] | 9, &, % | b, a |
| Not a digit | [!0-9] | A, a, &, ~ | 0, 1, 9 |
| Combined | a[!b-m]# | An9, az0, a99 | abc, aj0 |